package com.caltco.cargo.ops.modules.sys.dao;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.caltco.cargo.ops.modules.sys.entity.SysUserEntity;
import com.caltco.cargo.ops.modules.sys.vo.UserInfoVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SysUserDao extends BaseMapper<SysUserEntity> {
    /**
     * 查询用户的所有权限
     * @param userId  用户ID
     */
    List<String> queryAllPerms(Long userId);

    /**
     * 查询用户的所有菜单ID
     */
    List<Long> queryAllMenuId(Long userId);

    /**
     * 查询用户的所有用户
     */
    @Select("select * from sys_user u left join sys_user_role ur on ur.user_id = u.user_id where ur.roleId in #{roleIds}")
    List<SysUserEntity> getUserInfoByRoleIds(@Param(value = "roleIds") List<String> roleIds );


    UserInfoVo getCurUserInfo(@Param("userId") Long userId);
}
